package com.loyi.cloud.hbmis.domain;

import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;

import org.springframework.beans.BeanUtils;

public abstract class EntityBase {

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		for(PropertyDescriptor desc:BeanUtils.getPropertyDescriptors(this.getClass())){
			try {
				sb.append(String.format("\r\n%s=%s", desc.getName(),desc.getReadMethod().invoke(this)));
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
}
